class ActivationsController < ApplicationController
    before_filter :require_no_user

    def new
      @user = User.find_by_persistence_token(params[:id], 1.week) || (raise Exception)
      raise Exception if @user.active?
    end

    def create
      @user = User.find_by_persistence_token(params[:id])
      raise Exception if @user.active?

      if @user.activate!(params)
        @user.deliver_activation_confirmation!
        flash[:notice] = "Your account has been activated!"
        redirect_to account_url
      else
        render :action => :new
      end
    end
end
